home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / HippoDraw / HippoDrawSrc1.1 / Hippo.subproj / InspectBase.m < prev    next >
Encoding:
Text File  |  1992-04-25  |  1.8 KB  |  92 lines

  1. /* InspectBase.h        by Paul Kunz    December 1991
  2.  * Base class for Inspectors of Tuples and Plots.
  3.  *
  4.  * $Id: InspectBase.m,v 1.16 1992/04/25 18:56:24 pfkeb Rel $
  5.  *
  6.  * Copyright (C)  1991  The Board of Trustees of
  7.  * The Leland Stanford Junior University.  All Rights Reserved.
  8.  */
  9.  
  10. #import "InspectBase.h"
  11.  
  12. #import "DrawDocument.h"
  13. #import "HDraw.h"
  14. #import "HGraphicView.h"
  15. #import "NewInspector.h"
  16. #import "Overlay.h"
  17. #import "Plot.h"
  18.  
  19. @implementation InspectBase
  20.  
  21. - initInspFor:aDraw
  22. {
  23.     self = [super init];
  24.     hDraw = aDraw;
  25.     theInspector = [hDraw newInspector];
  26.     return self;
  27. }
  28.  
  29. - windowDidUpdate:sender
  30. {
  31.     [self load:[[hDraw currentDocument] view]];
  32.     return self;
  33. }
  34. - load:aView
  35. {
  36.     id        graphic;
  37.     BOOL        test;
  38.     
  39.     graphicView = aView;
  40.     if ( !graphicView ) {
  41.         selectedPlot = nil;    /* reset so that updateView can test it */
  42.     firstPlot = nil;
  43.     [self setTuple:NULL];
  44.     return self;
  45.     }
  46.     test = [[graphicView window] isKeyWindow];
  47.     if (!test)
  48.     return self;    /* ignore events other than from main window */
  49.  
  50.     if ( [graphicView hasEmptySelection] ) {
  51.     selectedPlot = nil;
  52.     firstPlot = nil;
  53.     [self updateEmptySelection];
  54.     return self;
  55.    }
  56.     graphic = [graphicView firstPlot];
  57.     if (!graphic) {
  58.         [ self updateMultiSelection];
  59.     return self;
  60.     }
  61.     selectedPlot = graphic;
  62.     firstPlot = selectedPlot;
  63.     [self updateView];
  64.     return self;
  65. }
  66. - firstPlot
  67. {
  68.     if ( [graphicView hasEmptySelection] ) {
  69.         return nil;
  70.     }
  71.     return firstPlot;
  72. }
  73.  
  74. /* Methods to be over-ridden by derived class */
  75. - updateView
  76. {
  77.     return self; /* to be over-ridden by derived class */
  78. }
  79. - updateEmptySelection
  80. {
  81.     return self; /* to be over-ridden by derived class */
  82. }
  83. - updateMultiSelection
  84. {
  85.     return self;
  86. }
  87. - setTuple:(ntuple) aTuple
  88. {
  89.     return self; /* to be over-ridden by derived class */
  90. }
  91. @end
  92.